<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>消息详情</title>
    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="css/comments.css" media="all">
    <link rel="stylesheet" href="css/eleTree.css">
    <style>
        .layui-form-label{
            width: 110px;
        }
        @media screen and (max-width: 450px){
            .layui-form-item .layui-input-inline {
                margin-left: 140px;
            }
        }
        .layui-input-block{
            margin-left: 150px;
        }
        .ele_gray{
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
        }
        .eleTree-node.child-my-child-2{
            display: inline-block;
        }
    </style>
</head>
<body>
    <div class="maincontainer">
        <blockquote class="layui-elem-quote">
            消息详情
            <button type="button" class="layui-btn layui-btn-sm" style="float: right;margin-top: -4px;" onclick="window.history.back();">返回</button>
        </blockquote>
        <form class="layui-form" action="" lay-filter="example">
            <div class="layui-form-item">
              <label class="layui-form-label">消息标题：</label>
			  <div class="layui-form-mid layui-word-aux title"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">时间：</label>
                <div class="layui-form-mid layui-word-aux createTime"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">发布到区域：</label>
                <div class="layui-input-block" style="position: relative;">
                    <div class="eleTree ele1">
                    </div>
                    <div class="ele_gray"></div>
                </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">消息内容：</label>
			  <div class="layui-form-mid layui-word-aux content"></div>
            </div>
        </form>
    </div>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>

    layui.config({
        base: 'plugins/layui/modules/',
    }).use(['http', 'form', 'eleTree'], function() {
        var http = layui.http,
            form = layui.form,
            eleTree = layui.eleTree;

        var id = http.getPid('id')
            
        getDetail()

        //用户权限
        var el = '';
        function getPermission(regionVoList,regionIdSet){
            // http.get('admin/region/listAllRegion',{},function(res){
            //     if(res.code == 200){
            //         var data = res.data;
                    el = eleTree.render({
                        elem: '.ele1',
                        data: regionVoList,
                        showCheckbox: true,
                        defaultExpandAll:true,
                        defaultCheckedKeys: regionIdSet,
                        request: {     // 对后台返回的数据格式重新定义
                            name: "regionName",
                            key: "id",
                            children: "children",
                            checked: "checked",
                            disabled: "disabled",
                            isLeaf: "isLeaf",
                            level: "level"
                        }
                    });
            //     }
            // });
        }

        // 消息详情
        function getDetail(){
            http.get('admin/message/findById',{
                id: id
            },function(res){
                if(res.code == 200){
                    var data = res.data;
                    $('.title').html(data.title)
                    $('.createTime').html(data.createTime)
                    $('.content').html(data.content)
                    getPermission(data.regionVoList,data.regionIdSet);
                    
                }
            });
        }
    })
</script>
</body>
</html>